package timbap.visualizer.coreplugins;

import processing.core.PApplet;
import timbap.visualizer.api.model.RecordItem;
import timbap.visualizer.api.model.Transformation;
import timbap.visualizer.api.plugin.recorditems.AbstractSelectedRecordItemPlugin;

public class CueModeOverlayPlugin extends AbstractSelectedRecordItemPlugin {


    protected void applyRecordItemTrafo(RecordItem pRecordItem, float pScaleFactor) {

        Transformation tRecordItemTrafo = pRecordItem.getTransformation();

        getContext().getP5Applet().translate(tRecordItemTrafo.getXTranslation(),
                                             tRecordItemTrafo.getYTranslation(),
                                             tRecordItemTrafo.getZTranslation());
        getContext().getP5Applet().scale(tRecordItemTrafo.getScaleFactor() * pScaleFactor);
        getContext().getP5Applet().rotateX(tRecordItemTrafo.getXRotation());
    }

    public void drawRecordItem(RecordItem pRecordItem) {

        getContext().getP5Applet().pushMatrix();
        applyRecordItemTrafo(pRecordItem, getContext().getCfg().getScreenHeight() / 400f);

        getContext().getP5Applet().translate(0,0,2);

        getContext().getP5Applet().fill(0,0,0,120);
        getContext().getP5Applet().arc(0, 0, 100, 100, 0, PApplet.TWO_PI);

        getContext().getP5Applet().fill(255,255,255,200);
        getContext().getP5Applet().rect(-7.5f,10,5,20);
        getContext().getP5Applet().rect(2.5f,10,5,20);
        getContext().getP5Applet().fill(0,0,0,255);

        getContext().getP5Applet().popMatrix();
    }




}